package com.cloudcross.ssp.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cloudcross.ssp.base.dao.GenericIBatisDao;
import com.cloudcross.ssp.common.utils.MapBuilder;
import com.cloudcross.ssp.common.utils.Pager;
import com.cloudcross.ssp.model.AdGroupSchedule;
import com.cloudcross.ssp.service.IAdGroupScheduleService;

@Service
public class AdGroupScheduleService implements IAdGroupScheduleService {

    @Autowired
    private GenericIBatisDao myBatisDao;

    @Override
    public AdGroupSchedule findById(Long id) {
        return null;
    }

    @Override
    public int countByParams(Map<String, Object> paramMap) {
        return 0;
    }

    @Override
    public List<AdGroupSchedule> findByParams(Map<String, Object> paramMap, Pager pager) {
        return null;
    }

    @Override
    public boolean add(AdGroupSchedule t) {
        return false;
    }

    @Override
    public boolean edit(AdGroupSchedule t) {
        return false;
    }

    @Override
    public boolean updateStatus(List<Long> idList, int status) {
        return false;
    }

    @Override
    public boolean batchAdd(List<AdGroupSchedule> scheduleList) {
        if (null == scheduleList || scheduleList.size() == 0) {
            return false;
        }
        myBatisDao.save("adGroupScheduleSqlMapper.batchAdd",
                MapBuilder.create(HashMap.class).add("scheduleList", scheduleList).map());
        return true;
    }

    @Override
    public boolean deleteByAdGroupId(Long adGroupId) {
        myBatisDao.delete("adGroupScheduleSqlMapper.deleteByAdGroupId", adGroupId);
        return false;
    }

    @Override
    public boolean copyAdgroupSchedule(long oldAdgroupId, long newAdgroupId) {
        Map<String, Object> condition = new HashMap<String, Object>();
        condition.put("oldAdgroupId", oldAdgroupId);
        condition.put("newAdgroupId", newAdgroupId);
        myBatisDao.save("adGroupScheduleSqlMapper.copyAdgroupSchedule", condition);
        return true;
    }
}
